package com.ash.vault;


import JavaAPI.*;
import com.ash.service.TransactionService;

public class TestTempConvertPermanent {


    public static void main(String[] args) {

        TransactionService transactionService = TransactionService.getInstance();
        HttpsPostRequest mpgReq = transactionService.getHttpsPostRequest();

        // temporary token
        String data_key = "ot-SB4f3tQUrqhOworLLUTUg54x2";
        String expdate = "2001";
        String phone = "0000000000";
        String email = "bob@smith.com";
        String note = "my note";
        String cust_id = "ootdbuy";
        String crypt_type = "7";
        String data_key_format = "0";



        AvsInfo avsCheck = new AvsInfo();
        avsCheck.setAvsStreetNumber("212");
        avsCheck.setAvsStreetName("Payton Street");
        avsCheck.setAvsZipCode("M1M1M1");

        //Credential on File details
        CofInfo cof = new CofInfo();
        cof.setIssuerId("139X3130ASCXAS9");

        ResAddToken resAddToken = new ResAddToken();
        resAddToken.setDataKey(data_key);
        resAddToken.setCryptType(crypt_type);
        resAddToken.setExpdate(expdate);
        resAddToken.setCustId(cust_id);
        resAddToken.setPhone(phone);
        resAddToken.setEmail(email);
        resAddToken.setNote(note);
        resAddToken.setAvsInfo(avsCheck);
        resAddToken.setCofInfo(cof);
        //resAddToken.setDataKeyFormat(data_key_format); //optional


        mpgReq.setTransaction(resAddToken);

        mpgReq.send();

        try {
            Receipt receipt = mpgReq.getReceipt();

            System.out.println("DataKey = " + receipt.getDataKey());
            System.out.println("ResponseCode = " + receipt.getResponseCode());
            System.out.println("Message = " + receipt.getMessage());
            System.out.println("TransDate = " + receipt.getTransDate());
            System.out.println("TransTime = " + receipt.getTransTime());
            System.out.println("Complete = " + receipt.getComplete());
            System.out.println("TimedOut = " + receipt.getTimedOut());
            System.out.println("ResSuccess = " + receipt.getResSuccess());
            System.out.println("PaymentType = " + receipt.getPaymentType());
            System.out.println("Cust ID = " + receipt.getResCustId());
            System.out.println("Phone = " + receipt.getResPhone());
            System.out.println("Email = " + receipt.getResEmail());
            System.out.println("Note = " + receipt.getResNote());
            System.out.println("MaskedPan = " + receipt.getResMaskedPan());
            System.out.println("Exp Date = " + receipt.getResExpdate());
            System.out.println("Crypt Type = " + receipt.getResCryptType());
            System.out.println("Avs Street Number = " + receipt.getResAvsStreetNumber());
            System.out.println("Avs Street Name = " + receipt.getResAvsStreetName());
            System.out.println("Avs Zipcode = " + receipt.getResAvsZipcode());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

